<?php

namespace app\api\controller;

use app\common\controller\Api;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $this->success('请求成功');
    }

    public function up(){
        $temp=$this->request->param('t');
        $hum=$this->request->param('h');

        $data=[
            'temperature'=>$temp,
            'humidity'=>$hum,
            'createtime'=>time(),
        ];
        db('temhum')->insert($data);
        $this->success('请求成功');
    }
    public function getth(){
        $tem_hum=db('temhum')->order('id desc')->find();

        $this->success('请求成功',$tem_hum);
    }
}
